﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DotNet.Random.Time
{
    /// <summary>
    /// 小时随机类，继承于IntRandService
    /// </summary>
    public class HourRandService : DotNet.Random.Int.IntRandService
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="HourRandService" /> class.
        /// </summary>
        public HourRandService()
        {
            for (int i = 0; i < 24; i++)
            {
                this.Serial.Add(i);
            }
        }

        /// <summary>
        /// Rands this instance.
        /// 随机生成数字方法
        /// 映射到虚方法中，扩展时，可重写
        /// </summary>
        /// <returns>
        /// 返回int类型
        /// </returns>
        public override int Rand()
        {
            var res = this.Build.Rand(this.Serial, 1);
            return res.FirstOrDefault();
        }
    }
}
